package service.impl;

import java.util.List;

import persistence.dao.TdfkfaUserDAO;
import persistence.model.TdfkfaUser;
import persistence.model.TdfkfaUserExample;
import service.LoginService;

public class LoginServiceImpl implements LoginService {

    private TdfkfaUserDAO tdfkfaUserDAO;

    public Integer getUserPlanId(String userName) {
        TdfkfaUserExample example = new TdfkfaUserExample();
        example.createCriteria().andUsernameEqualTo(userName);
        List<TdfkfaUser> userList = tdfkfaUserDAO.selectByExample(example);
        Integer planId = userList.get(0).getPlanId();
        return planId;
    }

    public void setTdfkfaUserDAO(TdfkfaUserDAO tdfkfaUserDAO) {
        this.tdfkfaUserDAO = tdfkfaUserDAO;
    }

}
